UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'W0jXf38juohkiPahkULBUfxnov8GUKAKhv8fH+/T2nw=' 
WHERE 
  key_id = '640bfffef3e25d5577ae72e14fe8097651b8da5a084cbd83b1145b0f506643a3' 
  AND (
    token = 'W0jXf38juohkiPahkULBUfxnov8GUKAKhv8fH+/T2nw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030