UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'BBx9T8sFpHJxgfMo/VoWUQvz7Y4egnaflHC0v49PUSA='
WHERE
key_id = 'a2cd8e909e157c552a9ed50c07679a43583987e31bbd89067fe310406df3396a'
AND (
token = 'BBx9T8sFpHJxgfMo/VoWUQvz7Y4egnaflHC0v49PUSA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)