UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iqSPG5M76kO1F1jUHcpkfRFipxt2cFvlYxBq8cVA5U8='
WHERE
key_id = 'd9b508e73c21086c7397b289c6283823cc0f2c1071b94af21bac6e71b68694a7'
AND (
token = 'iqSPG5M76kO1F1jUHcpkfRFipxt2cFvlYxBq8cVA5U8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)