UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pvfzuPdz1Q6SlKT5SFDgF4wFAbzxyMmwAJRXeCfOMew='
WHERE
key_id = '163191556e2ced1a82ecd265b3d2de234be86fda120f509b23e48f3855d803dc'
AND (
token = 'pvfzuPdz1Q6SlKT5SFDgF4wFAbzxyMmwAJRXeCfOMew='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)