UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KgSEZNQy4M+38rbeSIxelRkCYk+DB6wfMI+AMh3Z084='
WHERE
key_id = '27a33d6a4c44f315afe23c9e6e50c5dee3d73028c03e96361b03979c0223ce71'
AND (
token = 'KgSEZNQy4M+38rbeSIxelRkCYk+DB6wfMI+AMh3Z084='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)