UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5udz9W3I1a9TUfHw270/H+c//wDt0yWtIerXk5Tr8Xk='
WHERE
key_id = '6d1851c27ee5a5ef8ed45787bd49b0f3904ac5165d8e74d944a632b6778aa647'
AND (
token = '5udz9W3I1a9TUfHw270/H+c//wDt0yWtIerXk5Tr8Xk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)