UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'm833KIndKnKgQgJn205KsPDEx4uPWb+D320y2fgZ02Y=' 
WHERE 
  key_id = '41ceee2fb0d7821475e9436e7e71d623e561d0b855534efac8ebb387a0f2181e' 
  AND (
    token = 'm833KIndKnKgQgJn205KsPDEx4uPWb+D320y2fgZ02Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050