UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NHu6OiRdUDFcD4Ppkl3THMDyJW1DUTA+qyQo4+tjY6M='
WHERE
key_id = '378ba1915987424113b6988af6e8595627470dd543e95dbf614ff48a823ffdd1'
AND (
token = 'NHu6OiRdUDFcD4Ppkl3THMDyJW1DUTA+qyQo4+tjY6M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)