UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0rXABggUW/w6IL/aayJf78wYpIH0nPpOiLXuFeuNrUY='
WHERE
key_id = '0f508a6bcb3413893a97507417e168a8b24542b1903f7fdcc935644ec994292c'
AND (
token = '0rXABggUW/w6IL/aayJf78wYpIH0nPpOiLXuFeuNrUY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)