UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KhfwHiSLosfFwQ74iIPAPH4/gX9CJUEKNt4t6flm0NU='
WHERE
key_id = 'ff5e185dac2d6d65f2f8ec0dda5450459a2f8dbf977cfeb1452d25c99c167c48'
AND (
token = 'KhfwHiSLosfFwQ74iIPAPH4/gX9CJUEKNt4t6flm0NU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)