UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LkGLCxSETtPEQsuwALeK3bw3ZIND3eONzjw4T5gTXac=' 
WHERE 
  key_id = '91ad257b503edb475ac880159bf7771773ce3cbb1464bf69a405fe77b563418e' 
  AND (
    token = 'LkGLCxSETtPEQsuwALeK3bw3ZIND3eONzjw4T5gTXac=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016