UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3B3atYX4S4JjJXit5RcMcWcNXGZaeQx8vCzuyD2Ug7U='
WHERE
key_id = 'd44bcca1b90025b7786580310a8453d52d5f5eb23d863442621f8615b2786cf2'
AND (
token = '3B3atYX4S4JjJXit5RcMcWcNXGZaeQx8vCzuyD2Ug7U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)