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

Query time 0.00032