UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YtrSEHRka+GkcQ+rVDS0UalVEkInNJmfSDwXD0TTl6g='
WHERE
key_id = '58d867c4ae4565630b63405a0c93ea4d87b1a5f53cbacc04b2ff13c347800c61'
AND (
token = 'YtrSEHRka+GkcQ+rVDS0UalVEkInNJmfSDwXD0TTl6g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)