UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9Oi6I5fGBkPlrQJ7yaeuCTOiEQkayNQJdNAcpqoq1cg='
WHERE
key_id = 'd092292421028d1facf5f08b211a0ac8e7b6a434a158f6a696e0a1d4261499ee'
AND (
token = '9Oi6I5fGBkPlrQJ7yaeuCTOiEQkayNQJdNAcpqoq1cg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)