UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'kUdZ+yz4ICnuiryJU7A37NNbBiJsCeSRm6pyzGcmAl8='
WHERE
key_id = '1ff8199c70091604625332fa0db1f9c1ff7b1859f6440ae13f6445724a2942b3'
AND (
token = 'kUdZ+yz4ICnuiryJU7A37NNbBiJsCeSRm6pyzGcmAl8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)