UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9POSaXRgrquxvUPFJD78UdFb4WolP45i4M6CkVe9B2g=' 
WHERE 
  key_id = '0c9125c7780c61267e4f062f89d4b4293feaf47688563c05d5acf853ecb22a2f' 
  AND (
    token = '9POSaXRgrquxvUPFJD78UdFb4WolP45i4M6CkVe9B2g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046