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