UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dNGC8LXDqWcN8X2VHCiArSdggrVcDNId3mNAlPxZSbc='
WHERE
key_id = 'cc4373d65f44a5e3c0d895b0c423cba33a26ca40847d5473149bea261a3d5c32'
AND (
token = 'dNGC8LXDqWcN8X2VHCiArSdggrVcDNId3mNAlPxZSbc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)