UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gTYQqDEbFa8idvfhLXT9Xg95dc5sWQhVx9ip6o8nNxQ='
WHERE
key_id = '5bec4bb8e7d4445c5a438fc2e8beed82281608828828afdb4a31ca06042878fb'
AND (
token = 'gTYQqDEbFa8idvfhLXT9Xg95dc5sWQhVx9ip6o8nNxQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)