UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'SsI+6+JkhTcOIaE4th3oY+CsVWZEJZ+97SjUTM8UGF4='
WHERE
key_id = '3a8b95b47ccaa75c05fea8e48e08a5f1be58d2914c66b03fb1f0c4f4555082bd'
AND (
token = 'SsI+6+JkhTcOIaE4th3oY+CsVWZEJZ+97SjUTM8UGF4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)