UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'B5CjA0IDqk+MuyJmOlrPaDz600uafRJvx+jNb/OkMbg='
WHERE
key_id = 'da851dfdcd08c8fa78a9dc1653779d6543fe340aaf0a320ce8a1e281228ab7d0'
AND (
token = 'B5CjA0IDqk+MuyJmOlrPaDz600uafRJvx+jNb/OkMbg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)