UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'enEMDoY06NrvOqY/QI7/AFgQgzT99udB6ESZn6/gG4c='
WHERE
key_id = '7fbec39631cf879347d443b73abf3e6a8c5393f7ce240e348bf1409d1f0f1dd1'
AND (
token = 'enEMDoY06NrvOqY/QI7/AFgQgzT99udB6ESZn6/gG4c='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)