UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lM+13krrGzLZdD7xSRKOa8st+avUA+FTtNTmqnwpvPI='
WHERE
key_id = '8a6f080cff955fad4d8d174e16b35f3904f100369d50f3055004f93a0279b3b5'
AND (
token = 'lM+13krrGzLZdD7xSRKOa8st+avUA+FTtNTmqnwpvPI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)