UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Iog+K9gpM3UFXVTI1I7HcVTd90fkcYGEEWP3WZI2Tn8='
WHERE
key_id = 'd0443c416a6d6514d799272a4baa4e008f65cb63d3f7e1bbb3bb60b818d5a560'
AND (
token = 'Iog+K9gpM3UFXVTI1I7HcVTd90fkcYGEEWP3WZI2Tn8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)