UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'b7LtvRSZyKD24vYyUASqdVSekQLGr45JF+2gzw9SUuo=' 
WHERE 
  key_id = '890c1344107c433786629501e51402635b7282ca2fb198f61d087ead31d4578f' 
  AND (
    token = 'b7LtvRSZyKD24vYyUASqdVSekQLGr45JF+2gzw9SUuo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024