UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'X/GbxS9AwgkGfouow1J8RUZO/GnGU0ABKodGqX7hUXU='
WHERE
key_id = '3436b759348dfc8523b2320793979eba3cb221649fd9839ef3bce2296f03cfea'
AND (
token = 'X/GbxS9AwgkGfouow1J8RUZO/GnGU0ABKodGqX7hUXU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)