UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wQjifVLhNcwACnSqL5GkA7qpYkTxryEnaR/A+nsHwsk='
WHERE
key_id = '3ef70da70093686517ac998b2ea8efaa9d0f579ee5029b74c7aacadc09e19323'
AND (
token = 'wQjifVLhNcwACnSqL5GkA7qpYkTxryEnaR/A+nsHwsk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)